<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!-- 导航栏部分 -->
<footer th:fragment="nav">
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                        data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">轩轩社区</span>
                </button>
                <a class="navbar-brand" href="/">轩轩社区</a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <form class="navbar-form navbar-left" action="/" method="get">
                    <div class="form-group">
                        <!--/*@thymesVar id="serach" type="java.lang.String"*/-->
                        <input type="text" class="form-control" name="serach" placeholder="请输入你搜索的问题"  ></div>
                    <button type="submit" class="btn btn-default">搜索</button>
                </form>
                <ul class="nav navbar-nav navbar-right">
                    <!--session 不为null则为登录状态-->
                    <li class="dropdown" th:if="${session.user != null}"><a href="/publish">提问</a></li>
                    <li class="dropdown" th:if="${session.user != null}"><a href="/profile/repiies">通知<span class="badge navigation_notice" th:text="${session.unreadCount}"></span></a></li>
                    <li class="dropdown" th:if="${session.user != null}">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                           aria-expanded="false"
                           th:utext="${session.user.getName() + '  欢迎你！ <span class=' + 'caret' + '></span>'}"></a>
                        <ul class="dropdown-menu">

                            <li><a href="/profile/questions">我的问题</a></li>
                            <li><a href="#">个人资料</a></li>
                            <li><a href="/logout">退出登录</a></li>
                        </ul>
                    </li>
                    <!--session 为null则为未登录状态-->
                    <li th:if="${session.user == null}">
                        <a th:href="@{'https://github.com/login/oauth/authorize?client_id=0a3644bfe6f3a24b63fe&redirect_uri=' + ${#httpServletRequest.getScheme() + '://' + #httpServletRequest.getServerName() + ':' + #request.getServerPort()  + #request.getContextPath() + '/'}  + 'callback&scope=user&state=1' }">@登录</a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>
</footer>

</body>
</html>